﻿<UserControl x:Class="Ezpay.UI.Views.NewCustomerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:c="clr-namespace:Ezpay.UI.Controls"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:prism="http://www.codeplex.com/prism"
             xmlns:views="clr-namespace:Ezpay.UI.Views"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <i:Interaction.Triggers>
        <prism:InteractionRequestTrigger SourceObject="{Binding AddServiceRequest}">
            <c:PopupChildWindowAction/>
        </prism:InteractionRequestTrigger>
    </i:Interaction.Triggers>
    <Grid>
        <c:AutoLayoutGrid CellPadding="10" >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition />
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock Text="New Customer" Style="{StaticResource Header}"/>

            <telerik:RadTabControl>
                <telerik:RadTabItem Header="Account Info">
                    <c:AutoLayoutGrid CellPadding="5" Margin="10"  DataContext="{Binding Customer}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="First Name" />
                        <TextBox Text="{Binding FirstName, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBlock Text="Middle Initial" />
                        <TextBox Text="{Binding MiddleInitial, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBlock Text="Last Name" />
                        <TextBox Text="{Binding LastName, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBlock Text="Home Phone" />
                        <TextBox Text="{Binding HomePhone, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBlock Text="Cell Phone" />
                        <TextBox Text="{Binding CellPhone, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBlock Text="Work Phone" />
                        <TextBox Text="{Binding WorkPhone, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBlock Text="Email" />
                        <TextBox Text="{Binding PrimaryEmail, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBlock Text="Work/Alternate Email" />
                        <TextBox Text="{Binding AlternateEmail, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBlock Text="Home Address" />
                        <TextBox Style="{StaticResource AddressTextBox}" Text="{Binding HomeAddress, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBlock Text="Building Name" />
                        <TextBox Text="{Binding BuildingName, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBlock Text="Duty Unit" />
                        <TextBox Text="{Binding DutyUnit, UpdateSourceTrigger=PropertyChanged}" />
                    </c:AutoLayoutGrid>
                </telerik:RadTabItem>
                <telerik:RadTabItem Header="Bank Info">
                    <c:AutoLayoutGrid CellPadding="5" Margin="10"  DataContext="{Binding Customer}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="130"/>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="Bank Name:"/>
                        <TextBox Text="{Binding BankName, UpdateSourceTrigger=PropertyChanged}"/>
                        <TextBlock Text="Branch Address:" />
                        <TextBox Height="80" TextWrapping="Wrap" AcceptsReturn="True" Text="{Binding BankAddress, UpdateSourceTrigger=PropertyChanged}"/>
                        <TextBlock Text="Bank Routing Number:"/>
                        <TextBox Text="{Binding BankRoutingNumber, UpdateSourceTrigger=PropertyChanged}"/>
                        <TextBlock Text="Account Number:"/>
                        <TextBox Text="{Binding BankAccountNumber, UpdateSourceTrigger=PropertyChanged}"/>
                    </c:AutoLayoutGrid>
                </telerik:RadTabItem>
                <telerik:RadTabItem Header="Services">
                    <DockPanel Margin="10">
                        <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Margin="0 0 0 10">
                            <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0 0 5 0" ToolTip="Add Subscription" Focusable="False" Command="{Binding AddServiceCommand}">
                                <Image Source="/Resources/Images/AddMark_10580.png"/>
                            </Button>
                        </StackPanel>
                        <telerik:RadGridView ItemsSource="{Binding Subscriptions}">
                            <telerik:RadGridView.Columns>
                                <telerik:GridViewDataColumn Header="Type" DataMemberBinding="{Binding Type}" Width="100"/>
                                <telerik:GridViewDataColumn Header="Provider" DataMemberBinding="{Binding Description}" Width="*"/>
                                <telerik:GridViewColumn Width="50">
                                    <telerik:GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" ToolTip="Remove Subscription">
                                                <Image Source="/Resources/Images/Clearallrequests_8816.png"/>
                                            </Button>
                                        </DataTemplate>
                                    </telerik:GridViewColumn.CellTemplate>
                                </telerik:GridViewColumn>
                            </telerik:RadGridView.Columns>
                        </telerik:RadGridView>
                    </DockPanel>
                </telerik:RadTabItem>
            </telerik:RadTabControl>

            <DockPanel LastChildFill="False">
                <Button Width="80" Content="Save" DockPanel.Dock="Right" Command="{Binding SaveCommand}"/>
            </DockPanel>
        </c:AutoLayoutGrid>
        <views:LoadingIndicator Visibility="{Binding IsSaving, Converter={StaticResource boolToVisibilityConverter}}"/>
    </Grid>
    

</UserControl>
